<!-- 面包屑 -->
<template>
  <div>
      <ul class="breadcumb">
          <li v-for="(v,i) in lists" :key="i">
            <router-link :to="v.path">{{v.meta.title}}</router-link> <span v-show="i<lists.length-1">/</span>
          </li>
      </ul>
  </div>
</template>

<script>
export default {
  data () {
    return {
      lists:[],
    }
  },
  methods:{

  },
  mounted(){
      // console.log(this.$route)
  },
  watch:{
    $route(to,from){
      console.log(to.matched);
      let matched=to.matched;
      if(matched.length && matched[0].name!='Home'){
        matched=[{path:'/',name:'Home',meta:{title:'首页'}},...matched]
      }
      this.lists=matched;
    }
  },
}

</script>

<style scoped>
  .breadcumb li{
    display:inline-block;
  }
</style>
